import Vue from 'vue'
import VueRouter from 'vue-router'

Vue.use(VueRouter)

const routes = [
  {
    path: '/',
    redirect:'addDistribution'
  },
  {
    path: '/login',
    name: 'login',
    component: () => import(/* webpackChunkName: "login" */ '../views/login.vue')
  },
  {
    path: '/home',
    name: 'home', 
    component: () => import(/* webpackChunkName: "home" */ '../views/home.vue')
  },
  {
    path: '/policyDetails',
    name: 'PolicyDetails',  // 政策详情页
    component: () => import(/* webpackChunkName: "policyDetails" */ '../views/policyDetails.vue')
  },
  {
    path: '/distribution',
    name: 'Distribution',  // 分销
    component: () => import(/* webpackChunkName: "distribution" */ '../views/distribution.vue')
  },
  {
    path: '/order',
    name: 'Order',  // 订单
    component: () => import(/* webpackChunkName: "order" */ '../views/order.vue')
  },
  {
    path: '/addDistribution',
    name: 'AddDistribution',  // 添加分销团队
    component: () => import(/* webpackChunkName: "addDistribution" */ '../views/addDistribution.vue')
  },
  {
    path: '/distributionTeam',
    name: 'DistributionTeam',  // 添加分销团队
    component: () => import(/* webpackChunkName: "distributionTeam" */ '../views/distributionTeam.vue')
  },
]

const originalPush = VueRouter.prototype.push;
 
VueRouter.prototype.push = function push(location) {
  return originalPush.call(this, location).catch(err => err)
}

const router = new VueRouter({
  mode: 'history',
  base: process.env.BASE_URL,
  routes
})

export default router
